﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using UnityEngine;

public class FileUploadedEventArgs : EventArgs
{
    public int FileProgress { get; set; }
}

public class FileUploader
{
    public event EventHandler<FileUploadedEventArgs> FileUploaded;

    public void Upload()
    {
        FileUploadedEventArgs e = new FileUploadedEventArgs() { FileProgress = 100 };

        while (e.FileProgress>0)
        {
            e.FileProgress--;
            if (FileUploaded != null)
            {
                FileUploaded(this, e);
            }
        }
    }

}

public class _41 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        FileUploader fl = new FileUploader();
        fl.FileUploaded += ProgressMeth;
        fl.Upload();
    }

    private void ProgressMeth(object sender, FileUploadedEventArgs e)
    {
        Debug.LogError(e.FileProgress);
    }

    // Update is called once per frame
    void Update()
    {

    }
}


